package com.chen.kotlinproject

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
 * 文件名：MyViewMOdel
 * 创建者：陈春松
 * 邮箱：1742668568@qq.com
 * 创建时间 : 2020/1/2/002 10:01
 * 描述 :
 */
class MyViewMOdel : ViewModel() {
    var scoreA: MutableLiveData<Int>
    var scoreB: MutableLiveData<Int>

    init {
        scoreA = MutableLiveData()
        scoreA.value = 0
        scoreB = MutableLiveData()
        scoreB.value = 0
    }

    fun addScoreA(int: Int){
        scoreA.value = scoreA.value?.plus(int)
    }

    fun addScoreB(int: Int){
        scoreB.value = scoreB.value?.plus(int)
    }
}